<?php
function pc_sondages_repondus() {
	global $Utilisateurs;
	$nb_sondages = count_open_poll();
	if($nb_sondages == 0) return 100;
	$nb_repondus = $Utilisateurs->utilisateur(get_member_id($_SESSION['phppoll_connect']))->repondu_size();
	return intval($nb_repondus * 100 / $nb_sondages);
}
function connecte() {
	global $Utilisateurs;
	global $Configuration;
	if(get_member_id($_SESSION['phppoll_connect']) >= 0 && !empty($_SESSION['phppoll_connect']))
		return true;
	else
		return false;
}
function get_member_id($name) {
	global $Utilisateurs;
	$i = 0;
	$size = $Utilisateurs->utilisateur_size();
	while($i < $size) {
		$var = $Utilisateurs->utilisateur($i);
		if($var->pseudo() == $name) {
			return $i;
		}
		$i++;
	}
	return -1;
}
function admin() {
	if($_SESSION['phppoll_connect'] == conf('admin') && connecte()) 
		return true;
	else
		return false;
}
?>